# 员工登录
import requests

from common.config import getconf
from common.get_cookie import get_park_token as park_token

def login_token(env):
    base_url = getconf(env, "parking_service_url")
    url = base_url + "/v1/parking/login"
    headers = {"content-type": "application/json"}
    dict = {
        "accountCode": getconf(env, "parking_accountCode"),
        "accountPwd": getconf(env, "parking_accountPwd"),
        "parkingSentryBoxId": getconf(env, "parkingSentryBoxId")
    }

    rsp = requests.post(url, headers=headers, json=dict).json()
    return rsp['data']['token']

def internal_token(env):
    user = getconf(env, "new_park_user")
    pw = getconf(env, "new_park_pw")
    return park_token(env, user, pw)



